package com.yunc.base.security.config;

import com.yunc.base.security.filter.JWTAuthorizationFilter;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.web.DefaultSecurityFilterChain;
import org.springframework.stereotype.Component;

import javax.servlet.Filter;

/**
 * @author taocongcong
 * @create 2020-01-02 9:48
 */
@Component("permitAllSecurityConfig")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class PermitAllSecurityConfig extends SecurityConfigurerAdapter<DefaultSecurityFilterChain,HttpSecurity> {

    private final Filter permitAuthenticationFilter;

    @Override
    public void configure(HttpSecurity http) {
        http.addFilterBefore(permitAuthenticationFilter, JWTAuthorizationFilter.class);
    }

}
